home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-26 | 1.6 KB | 68 lines | [TEXT/MPS ] |
- /*
- File: Exceptions.c
-
- Contains: exception handling stuff
- Brutally stolen from the Finder 7.1 sources
- Brutally restolen from the Star Trek runtime stuff
-
- Written by: Bruce Horn, Steve Capps, Larry Kenyon,
- John Meier, scott douglass, Darin Adler,
- Paul Mercer, Bryan Stearns, Dave Owens, Alan Mimms
-
- Copyright: © 1988-1990, 1993 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <1> 6/15/93 ABM first checked in
- <3> 12/10/92 dho afterProto
- <2> 9/30/92 dho move exceptions out of partition globals
- <3+> 8/21/92 dho 8.3
- <3> 8/17/92 dho use gFinderGlobals instead of gPartitionGlobals
- <2> 7/31/92 dho stub out asssembly exception calls
- <1> 7/24/92 dho First checked in for Star Trek
- 2/22/89 sad make Fail FAIL even if error == noErr
- 2/1/89 sad use dbgExceptionBreak
- 12/15/88 dba get rid of PRINT on FailNil
- 10/25/88 JRM add PRINT to Fail()
- 9/11/88 JRM use moretypes
- 8/29/88 dba added Fail
- 8/19/88 dba added FailMemError, FailResError, and FailResourceNil
-
- To Do:
- */
-
- #include <Types.h>
- #include <assert.h>
-
- #include "Exceptions.h"
-
-
- TException * gExceptionStack = (TException *) nil;
-
-
- TException::TException()
- {
- fNext = gExceptionStack;
- gExceptionStack = this;
- }
-
- TException::~TException()
- {
- Pop();
- }
-
- void TException::Pop()
- {
- gExceptionStack = fNext;
- }
-
- void Fail()
- {
- TException * currentException = gExceptionStack;
-
- assert(currentException != nil);
-
- currentException->Pop(); // go back to previous handler
- longjmp(currentException->fEnv,1); // warp nine Mr. Sulu
- }
-